1 <html>
2 <head>
3 <title>Saledetails </title>
4 <style>
5
6 body {
7 margin: 0;
8 font-family: Arial, Helvetica, sans-serif;
9 background: #484848;
10 }
11 .topnav {
12 overflow: hidden;
13 background-color: rgba(249, 105, 14, 1);
14 height: 70px;
15 border: 3px solid #e69500;
16 }
17
18 .topnav a {
19 float: left;
20 color: #f2f2f2;
21 text-align: center;
22 padding: 14px 16px;
23 text-decoration: none;
24 font-size: 35px;
25 font-weight: bold;
26 }
27 </style>
28 <body>
29 <div class="topnav">
30 <a class="active" href="home.html"><img src="ic_add_pet.png"></a>
31 <a href="sales.php">Sales details</a>
32
33 </div>
34 <?php
35
36 $servername = "localhost";
37 $username = "root";
38 $password = "";
39 $dbname = "Petshop_management";
40
41 // Create connection
42 $conn = new mysqli($servername, $username, $password, $dbname);
43 // Check connection
44 if ($conn->connect_error) {
45 die("Connection failed: " . $conn->connect_error);
46 }
47 //echo " CONNECTION ESTABLISHED \r\n";
48 //echo " INSERTION IN PROCESS";
49 $id=$_POST["t1"];
50 $pp=$_POST["t2"];
51 $Query2="select count(*) from sold_products where sd_id='$id' AND pp_id='$pp'";
52 $Execute = mysqli_query($conn,$Query2);
53 $count = mysqli_fetch_row($Execute);
54 if($count[0]==1)
55 {
56 $sql = "DELETE FROM sold_products WHERE sd_id='$id' AND pp_id='$pp'";
57 if ($conn->query($sql) == TRUE) {
58 echo '<div>
59 <h1 style="color:#f2f2f2;font-size:50px; font-family: "Roboto", sans-serif;margin:auto;">Data deleted successfully</h1>
60 </div>';
61 } else {
62 echo "Error: " . $sql . "<br>" . $conn->error;
63 }
64 }
65 else{
66 echo '<div>
67 <h1 style="color:#f2f2f2;font-size:40px; font-family: "Roboto", sans-serif;margin:auto;"> Data not found</h1>
68 </div>';
69 }
70
71 $conn->close();
72 ?>
73 <form>
74 <button type="submit" style=" height: 50px;width: 150px;cursor:pointer;border-radius:15px;
75 border: 3px solid #e69500;background-color: rgba(249, 105, 14, 1);color:#f2f2f2;font-size:15px;"formaction="soldproducts.php">back</button>
76 </form>
77 </body>
78 </html>